#!/usr/bin/ruby
# -*- ruby -*-
#
# http://programmingpraxis.com/2013/01/18/triangle-trilemma/

class Point
    attr_reader :x, :y

    def initialize(x, y)
        @x = x
        @y = y
    end

    def norm(b)
        a = self

        return nil unless b.is_a?(Point)
        return Math.sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y))
    end

    def dot(b)
        a = self
        return b.x * a.x + b.y * a.y
    end

    def pcross(b)
        a = self
        return a.x * b.y - a.y * b.x
    end

    def angle(b, c)
        a = self

        ba = Point.new(b.x - a.x, b.y - a.y)
        ca = Point.new(c.x - a.x, c.y - a.y)

        dot    = ba.dot(ca)
        pcross = ba.pcross(ca)

        return Math.atan2(pcross, dot)
    end
end

class Float
    def equals(f2, delta = 0.0001)
        return false unless f2.is_a?(Float)

        return (self - f2).abs <= delta
    end

    def to_deg
        return self * 180.0 / Math::PI
    end
end

Sides = {
    0 => "scalene",
    1 => "isoceles",
    2 => "equilateral",
}

STDIN.readlines.slice(1 .. -1).each do |line|
    x1, y1, x2, y2, x3, y3 = line.split(' ').map { |i| i.to_i }

    a, b, c = Point.new(x1, y1), Point.new(x2, y2), Point.new(x3, y3)

    # Is a triangle?
    area = ((a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y)) / 2.0).abs

    unless area.zero?
        # Sides
        d_ab = a.norm(b)
        d_ac = a.norm(c)
        d_bc = b.norm(c)

        sides = Sides[[d_ab.equals(d_ac), d_ab.equals(d_bc), d_ac.equals(d_bc)].select { |s| s }.size]

        # Angles
        abc = a.angle(b, c).abs.to_deg
        bca = b.angle(a, c).abs.to_deg
        cab = c.angle(a, b).abs.to_deg

        angle = "acute"
        angle = "right"  unless [abc, bca, cab].map { |a| a - 90.0 }.select { |a| a.equals(0.0) }.empty?
        angle = "obtuse" unless [abc, bca, cab].map { |a| a - 90.0 }.select { |a| a > 0.0 }.empty?

        puts "#{sides} #{angle} triangle"
    else
        puts "Not a triangle"
    end
end
